﻿@using Apps.Web.Core;
@using Apps.Common;
@using Apps.Models.PUB;
@using Apps.Web;
@using Apps.Locale;
@using Apps.Models.Sys;
@using Apps.Models.Enum;
@{
    ViewBag.Title = "入厂关联自采";
    Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
    List<permModel> perm = null;
    string dataIds = ViewBag.dataIds as string;
}
<div class="mvctool bgb">
    @Html.ToolButton("btnSave", "fa fa-save", Resource.Save, ref perm, "Save", true)
    @Html.ToolButton("btnReturn", "fa fa-reply", Resource.Reply, false)
</div>
<script type="text/javascript">
    $(function () {

        $("#btnQuery").click(function () {
           
            var selfTestCode1 = $("#selfTestCode1").val();
            if (selfTestCode1 == undefined) {
                window.parent.frameReturnByMes("请输入化验号");
            }
            if (selfTestCode1 == null) {
                window.parent.frameReturnByMes("请输入化验号");
            }
            if (selfTestCode1 == '') {
                window.parent.frameReturnByMes("请输入化验号");
            }

            var selfTestCode2 = $("#selfTestCode2").val();
            //if (selfTestCode2 == undefined) {
            //    window.parent.frameReturnByMes("请输入小焦炉焦炭编号");
            //}
            //if (selfTestCode2 == null) {
            //    window.parent.frameReturnByMes("请输入小焦炉焦炭编号");
            //}
            //if (selfTestCode2 == '') {
            //    window.parent.frameReturnByMes("请输入小焦炉焦炭编号");
            //}

            $.post("@Url.Action("Query")?id=" + selfTestCode1+"&id2="+selfTestCode2, function (data) {
                if (data.type == 0) {
                    window.parent.frameReturnByMes(data.message);
                }
                $("#txtCri").val(data.CRI);
                $("#txtCsr").val(data.CSR);
                $("#txtYxValue").val(data.YANX_VALUE);
              
              }, "json");

        });

        $("#btnSave").click(function () {
            
            //var ExamineRemark = $("#ExamineRemark").val();
            var chExamine = $('input:radio:checked').val();
            //if (chExamine == -1)
            //{
            //    if (ExamineRemark == "") {
            //        $.messageBox5s(Lang.Tip, '请填写审核不通过的说明');
            //        return;
            //    }
            //}
            if ($("form").valid()) {
                $.ajax({
                    url: "@Url.Action("Examine")",
                    type: "Post",
                    data: $("form").serialize(),
                    dataType: "json",
                    success: function (data) {
                        if (data.type == 1) {
                            window.parent.frameReturnByMes(data.message);
                            window.parent.frameReturnByReload(true);
                            window.parent.frameReturnByClose()
                        }
                        else {
                            window.parent.frameReturnByMes(data.message);
                        }
                    }
                });
            }
            return false;
        });
        $("#btnReturn").click(function () {
            window.parent.frameReturnByClose();
        });
    });
</script>
@using (Html.BeginForm())
{
    <input type="hidden" id="dataIds" name="dataIds" value="@dataIds" />
    <table class="formtable">
        <tbody>
            <tr>
                <th>
                    入厂批次：
                </th>
                <td>
                    @dataIds
                </td>
            </tr>
            <tr>
                <th>
                   化验码1：
                </th>
                <td>
                    <input class="text-box single-line" placeholder="" data-val="true" id="selfTestCode1" name="XJLM_CODE" type="text" value="" autocomplete="off">
                </td>
            </tr>
            <tr>
                <th>
                    化验码2：
                </th>
                <td>
                    <input class="text-box single-line" placeholder="" data-val="true" id="selfTestCode2" name="XJLJT_CODE" type="text" value="" autocomplete="off">
                </td>
            </tr>
            <tr>
                <th>

                </th>
                <td>
                    <input type="button" id="btnQuery" class="fa fa-search" value="获取自采煤数据" />
                </td>
            </tr>
            @*<tr>
                <th>
                    自采煤批次码：
                </th>
                <td>
                    <input class="text-box single-line" data-val="true" readonly id="txtSelfBatchCode" name="BATCH_CODE" type="text" value="" autocomplete="off">
                </td>
            </tr>
            <tr>
                <th>
                    采样类别：
                </th>
                <td>
                    <input class="text-box single-line" data-val="true" readonly id="txtSelfBatchType" name="BATCH_TYPE" type="text" value="" autocomplete="off">
                </td>
            </tr>*@
            @*<tr>
                <th>
                    类型：
                </th>
                <td>
                    <input class="text-box single-line" data-val="true" readonly id="txtSelfTypeStr" name="TYPE_STR" type="text" value="" autocomplete="off">
                </td>
            </tr>*@
            <tr>
                <th>
                    CRI：
                </th>
                <td>
                    <input class="text-box single-line" data-val="true" id="txtCri" name="CRI" type="text" value="" autocomplete="off">
                </td>
            </tr>
            <tr>
                <th>
                    CSR：
                </th>
                <td>
                    <input class="text-box single-line" data-val="true" id="txtCsr" name="CSR" type="text" value="" autocomplete="off">
                </td>
            </tr>
            <tr>
                <th>
                    岩相：
                </th>
                <td>
                    <input class="text-box single-line" data-val="true" id="txtYxValue" name="YANX_VALUE" type="text" value="" autocomplete="off">
                </td>
            </tr>
        </tbody>
    </table>
    @Html.ValidationSummary()
}

